<div class="easyui-layout" data-options="fit:true">
    <div data-options="region:'north'">
        <div style="height: 25px;">
            投资人数:<span id="totleCount"></span>&nbsp;&nbsp;
            投资金额:<span id="castAmount"></span>
        </div>
    </div>
    <div data-options="region:'center'">
        <table id="list2"></table>
    </div>
</div>

<script type="text/javascript">
    var targetId = $("#targetId").val();
    $(function () {
        $.get('/target/totalInvest', {"targetId": targetId}, function (jsonStr) {
            var data = jsonStr.data;
            var str = eval("(" + data + ")");
            $.each(str, function (key, value) {
                if (key == 'castAmount') {
                    $("#castAmount").html(str[key].toString().formatMoney());
                } else if (key == 'totleCount') {
                    $("#totleCount").html(str[key]);
                }
            })
        });
    });
    var url = "target/loanInvest?id=" + targetId;
    var columns2 = [[{
        field: 'number',
        title: '序号',
        width: '150px',
        formatter: function (value, row, index) {
            if (value <= 8) {
                return '0' + index + 1;
            } else {
                return index + 1;
            }
        }
    }, {
        field: 'telephone',
        title: '投资用户名',
        width: '150px',
    }, {
        field: 'buyAmt',
        title: '投资金额',
        width: '150px',
        align: 'right',
        formatter: function (value, row, index) {
            if (value) {
                return value.formatMoney();
            }
            return value;
        }
    }, {
        field: 'chanel',
        title: '投标方式',
        width: '150px',
        formatter: function (value, row, index) {
            return dic["chanel"][value.toString()];
        }
    }, {
        field: 'createdDate',
        title: '投资时间',
        width: '150px',
    }
    ]];
    $('#list2').datagrid({url: url, columns: columns2});
</script>